package com.ruoyi.manager.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.manager.domain.ArvinPasswordBdmap;
import com.ruoyi.manager.service.IArvinPasswordBdmapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * bamap账号管理Controller
 * 
 * @author arvin
 * @date 2020-09-03
 */
@RestController
@RequestMapping("/bdmap/bdmap")
public class ArvinPasswordBdmapController extends BaseController
{
    @Autowired
    private IArvinPasswordBdmapService arvinPasswordBdmapService;

    /**
     * 查询bamap账号管理列表
     */
    @PreAuthorize("@ss.hasPermi('bdmap:bdmap:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArvinPasswordBdmap arvinPasswordBdmap)
    {
        startPage();
        List<ArvinPasswordBdmap> list = arvinPasswordBdmapService.selectArvinPasswordBdmapList(arvinPasswordBdmap);
        return getDataTable(list);
    }

    /**
     * 导出bamap账号管理列表
     */
    @PreAuthorize("@ss.hasPermi('bdmap:bdmap:export')")
    @Log(title = "bamap账号管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ArvinPasswordBdmap arvinPasswordBdmap)
    {
        List<ArvinPasswordBdmap> list = arvinPasswordBdmapService.selectArvinPasswordBdmapList(arvinPasswordBdmap);
        ExcelUtil<ArvinPasswordBdmap> util = new ExcelUtil<ArvinPasswordBdmap>(ArvinPasswordBdmap.class);
        return util.exportExcel(list, "bdmap");
    }

    /**
     * 获取bamap账号管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('bdmap:bdmap:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(arvinPasswordBdmapService.selectArvinPasswordBdmapById(id));
    }

    /**
     * 新增bamap账号管理
     */
    @PreAuthorize("@ss.hasPermi('bdmap:bdmap:add')")
    @Log(title = "bamap账号管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArvinPasswordBdmap arvinPasswordBdmap)
    {
        arvinPasswordBdmap.setUserId(getUserId());
        return toAjax(arvinPasswordBdmapService.insertArvinPasswordBdmap(arvinPasswordBdmap));
    }

    /**
     * 修改bamap账号管理
     */
    @PreAuthorize("@ss.hasPermi('bdmap:bdmap:edit')")
    @Log(title = "bamap账号管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ArvinPasswordBdmap arvinPasswordBdmap)
    {
        return toAjax(arvinPasswordBdmapService.updateArvinPasswordBdmap(arvinPasswordBdmap));
    }

    /**
     * 删除bamap账号管理
     */
    @PreAuthorize("@ss.hasPermi('bdmap:bdmap:remove')")
    @Log(title = "bamap账号管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(arvinPasswordBdmapService.deleteArvinPasswordBdmapByIds(ids));
    }
}
